*This file generates the descriptive bar graph for Figure A.1.

use "$path/industry_data.dta", clear

destring isic, replace

label define isic 3812 "Steel shipbuilding" 3811 "Wooden shipbuilding" 3752 "Current apparatus" 3710 "Insulated wires and cables" 3820 "Railroad and tramway equipment" 3740 "Accumulators" 3839 "Motor vehicles" 3751 "Transformers, generators, motors" 2713 "Sulphite pulp mills" 3630 "Machinery" 2714 "Sulphate pulp mills" 3769 "Other weak current apparatus n.e.c" 2715 "Paper mills" 3832 "Automobile bodies" 3519 "Metal products" 2716 "Cardboard and paperboard mills" 3299 "Other petroleum and asphalt products" 3831 "Automobiles" 3508 "Metal sheet products" 2711 "Wood pulp mills" 2511 "Combined sawing and planing mills" 3510 "Enameling, plating, etc." 3340 "Manufacture of cement" 3393 "Manufacture of isolation materials" 3930 "Manufacture of precision instruments, n.e.c." 3411 "Manufacture of iron and steel" 3413 "Iron and steel foundries" 3311 "Manufacture of bricks and tiles" 3911 "Manufacture of scales" 3620 "Manufacture of motors" 3119 "Manufacture of other structural clay products" 1590 "Other mineral quarrying" 3720 "Manufacture of electric lamps" 3761 "Manufacture of radios and radio equipment" 2523 "Plywood mills" 2524 "Bobbin mills" 3115 "Manufacture of fertilizers" 3610 "Manufacture of agricultural machinery"
label values isic isic


*Collapse data by isic industry
collapse repa_sharel, by(isic)
decode isic, gen(label_isic) 
egen rank_repa_sharel = rank(repa_sharel), field
sort rank_repa_sharel

egen isic_name = concat(isic label_isic), punct(" ")
list isic_name repa_sharel rank_repa_sharel in f/20

*Isic name and code ("name + (isic code)") variable
tostring isic, gen(isic_str)
replace isic_str = "(" + isic_str + ")"
egen isic_name_code = concat(label_isic isic_str), punct(" ")

label variable isic "ISIC code"
label variable label_isic "Industry"
label variable rank_repa_sharel "Rank"
label variable repa_sharel "Reparations share"
label variable isic_name "Industry"

*Create value labels for rank_repa_sharel 
forvalues i=1/34 {
	local lab_rank_`i' = label_isic[`i'] 
	label define rank_repa_sharel `i' "`lab_rank_`i''", add
}
label list rank_repa_sharel

*Bar graph
graph hbar repa_sharel if rank_repa_sharel <= 38, over(isic_name_code, label(labsize(*0.4)) sort(rank_repa_sharel))   ytitle("Reparations share") 

*Color specific bars: ISIC industries starts with 25 and 27
separate repa_sharel, by(isic == 2511 | isic == 2711 | isic == 2713 | isic == 2714 | isic == 2715 | isic == 2716 | isic == 2523 | isic == 2524)

graph hbar repa_sharel1 repa_sharel0 if repa_sharel > 0, graphregion(lcolor(black) fcolor(white) ) graphregion(lcolor(black) fcolor(white) color(white)) over(isic_name_code, label(labsize(*0.75)) sort(rank_repa_sharel)) ytitle("Reparations share") bar(1, bcolor(red)) bar(2, bcolor(navy)) legend( label(1 "Established (25 and 27)") label(2 "Other")  position(bottom) )  saving(groups.gph, replace) title("Panel A", margin(b=-3)) 

*Scatter the variables

use "$path/industry_data.dta", clear

scatter repa_sharel ln_repa_tot if year==1944&repa_sharel>0, mlabel(isic) mlabcolor(navy) mcolor(navy)  saving(scatter.gph, replace) title("Panel B", margin(b=-15)) graphregion(lcolor(black) fcolor(white) ) graphregion(lcolor(black) fcolor(white) color(white)) ytitle("Reparations share") xtitle("ln(Value of reparation shipments)") 
 

*COMBINE GRAPHS
set graphics on

graph combine groups.gph scatter.gph, col(2) ysize(2) xsize(5) commonscheme  graphregion(margin(small) fcolor(white) lcolor(white) color(white)) plotregion(margin(small))

graph export "$graphs/descritptive_bar.eps",as(eps) font(Times) replace
graph export "$graphs/descritptive_bar.pdf",as(pdf) font(Times) replace
